<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/jquery-3.6.0.min.js"></script>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        .wrap {
            padding: 10px;
        }

        .button-group {
            margin-bottom: 20px;
        }

        .button-group button {
            padding: 2.5px 5px;
        }

        .slide {
            width: 1100px;
            height: 600px;
            border: 1px solid #333;
            position: relative;
        }

        .slide .ball {
            width: 100px;
            height: 100px;
            background-color: pink;
            border-radius: 50px;
            position: absolute;
            left: 0px;
            top: 0;
        }
    </style>
</head>

<body>
    <div class="wrap">
        <div class="button-group">
            <button class="start">开始</button>
            <button class="pause">暂停</button>
            <button class="back">返回</button>
        </div>
        <div class="slide">
            <div class="ball"></div>
        </div>
    </div>

</body>
<script>
    $(".start").click(function () {
        // $(".ball").animate({ left: 1000, top: 500 }, "fast", function () {
        //     console.log("到达终点");
        // })
        $(".ball").animate({ left: 1000, top: 500 }, 1000, function () {
            console.log("到达终点");
        })
    })

    $(".pause").click(function () {
        $(".ball").stop();
    })

    $(".back").click(function () {
        // $(".ball").animate({ left: 0, top: 0 }, "fast", function () {
        //     console.log("到达终点");
        // })
        $(".ball").animate({ left: 0, top: 0 }, 1000, function () {
            console.log("到达终点");
        })
    })

</script>

</html>